home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
-
-
- # test for correct usage
- #########################################
-
- if [ $# -gt 1 ]
- then
- echo "usage: `basename $0` [filename]"
- exit 1
- fi
-
-
- # check for optional arg
- #########################################
-
- if [ $# -eq 1 ]
- then
- outfile="$1"
- else
- outfile="winsnap.rgb"
- fi
-
-
-
- # select the desired window
- #########################################
-
-
- echo "`basename $0`: Please select the window you would like to snapshot"
- echo " by clicking the mouse in that window"
-
- win=`xwininfo | grep 'Corners:' | tr '+-' ' '`
-
- ### echo "$win"
-
- x1=`echo "$win" | awk '{print $2}'`
- x2=`echo "$win" | awk '{print $6}'`
- y1=`echo "$win" | awk '{print $3}'`
- y2=`echo "$win" | awk '{print $7}'`
-
- ### echo $x1,$y1 $x2,$y2
-
-
-
- # get root window info to find out the screen size
- ########################################################
-
- root=`xwininfo -root`
-
- xsize=`echo "$root" | grep 'Width:' | awk '{print $2}'`
- ysize=`echo "$root" | grep 'Height:' | awk '{print $2}'`
-
- ### echo $xsize, $ysize
-
-
-
- # find GL coordinates of the desired window
- ####################################################
-
- x1gl=$x1
- x2gl=`expr $xsize - $x2 - 1`
-
- y1gl=$y2
- y2gl=`expr $ysize - $y1 - 1`
-
- ### echo "scrsave $outfile $x1gl $x2gl $y1gl $y2gl"
-
-
- # do the snapshot
- #######################
-
- scrsave "$outfile" $x1gl $x2gl $y1gl $y2gl
-